home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / util / cli / ksc_Req.lha / Requesters.asm next >
Encoding:
Assembly Source File  |  1998-04-08  |  1.8 KB  |  104 lines

  1. ; Requesters 1.1 : turn DOS Requesters on/off
  2. ; by Kyzer/CSG
  3. ; $VER: Requesters.asm 1.1 (08.04.98)
  4. ;
  5.     incdir    include:
  6.     include    lvo/exec_lib.i
  7.     include    lvo/dos_lib.i
  8.     include    dos/dosextens.i
  9.  
  10. stackf    MACRO    ; stack_symbol, stackelement_symbol
  11.     IFND    \1
  12. \1    set    0
  13.     ENDC
  14. \1    set    \1-4
  15. \2    equ    \1
  16.     ENDM
  17.  
  18.     stackf    stk, swtoggle
  19.     stackf    stk, swoff
  20.     stackf    stk, swon
  21.     stackf    stk, rdargs
  22. args=swon
  23.  
  24.     move.l    4.w,a6
  25.     suba.l    a1,a1
  26.     jsr    _LVOFindTask(a6)
  27.     move.l    d0,a3
  28.     lea    pr_WindowPtr(a3),a3
  29.  
  30.     lea    dosname(pc),a1    ; dos.library v36+
  31.     moveq.l    #36,d0
  32.     jsr    _LVOOpenLibrary(a6)
  33.     tst.l    d0
  34.     bne.s    start
  35.  
  36. ; 1.3 compatible part (tee hee)
  37.     moveq    #-1,d0
  38.     cmp.l    (a3),d0
  39.     bne.s    .go
  40.     moveq    #0,d0
  41. .go    move.l    d0,(a3)
  42.     moveq    #0,d0
  43.     rts
  44.  
  45. start    move.l    d0,a6
  46.     link    a5,#stk
  47.  
  48.     lea    templat(pc),a0
  49.     move.l    a0,d1
  50.     lea    args(a5),a0    ; to fill swon, swoff and swtoggle
  51.     move.l    a0,d2
  52.     clr.l    (a0)+
  53.     clr.l    (a0)+
  54.     clr.l    (a0)+
  55.     moveq    #0,d3
  56.     jsr    _LVOReadArgs(a6)
  57.     move.l    d0,rdargs(a5)
  58.     beq.s    .noargs
  59.  
  60.     moveq    #0,d1
  61.     tst.l    swon(a5)
  62.     beq.s    .n1
  63.     addq    #1,d1
  64. .n1    tst.l    swoff(a5)
  65.     beq.s    .n2
  66.     addq    #1,d1
  67. .n2    tst.l    swtoggle(a5)
  68.     beq.s    .n3
  69.     addq    #1,d1
  70. .n3    cmp.b    #1,d1    ; exactly one of on, off or toggle
  71.     beq.s    .run
  72.     moveq    #ERROR_TOO_MANY_ARGS,d1
  73.     jsr    _LVOSetIoErr(a6)
  74.     bra.s    .done
  75.  
  76. .run    moveq    #-1,d0
  77.     tst.l    swtoggle(a5)
  78.     beq.s    .nottog
  79.     cmp.l    (a3),d0
  80.     bne.s    .set
  81.     moveq    #0,d0    ; set to -1 if was not -1 before, otherwise set to 0
  82. .nottog    tst.l    swon(a5)
  83.     beq.s    .set    ; d0 already set to 'off' - no change
  84.     moveq    #0,d0    ; swon WAS set - change from 'off' to 'on'
  85. .set    move.l    d0,(a3)
  86.  
  87. .done    move.l    rdargs(a5),d1
  88.     jsr    _LVOFreeArgs(a6)
  89.  
  90. .noargs    jsr    _LVOIoErr(a6)
  91.     move.l    d0,d1
  92.     moveq    #0,d2
  93.     jsr    _LVOPrintFault(a6)
  94.  
  95. .exit    move.l    a6,a1
  96.     move.l    4.w,a6
  97.     jsr    _LVOCloseLibrary(a6)
  98.     unlk    a5
  99.     moveq    #0,d0
  100.     rts
  101.  
  102. dosname    dc.b    "dos.library",0
  103. templat    dc.b    "ON/S,OFF/S,TOGGLE/S",0
  104.